<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Session;

class PlatformAuth
{
    public function handle($request, Closure $next)
    {

        $adminInfo = Session::get('admin');
        $adminPlatformInterface = resolve('App\Repositories\Contracts\AdminPlatformInterface');
        $platform = $adminPlatformInterface->get(['admin_id'=>$adminInfo['id']]);
        $request->merge(['admin_platform'=>$platform->pluck('platform')->toArray()]);

        return $next($request);
    }
}